<template>
  <view class="content">
    <details-top :title="`${labelName}详情`" :list="listData"/>
    <view class="box">
      <text class="header-title min">基本情况</text>
      <VcCardBox :list="cardData"></VcCardBox>
      <view class="basic"> {{ businessScope }}</view>
    </view>
    <view class="box" style="margin-top: 30rpx">
      <text class="header-title min">企业介绍</text>
      <view class="introduce">
        {{ enterpriseCulture }}
      </view>
    </view>
    <view class="box" style="margin-top: 30rpx">
      <text class="header-title min">主营业务</text>
      <view class="introduce">
        {{ mainBusiness }}
      </view>
    </view>
    <view class="box" style="margin: 30rpx 0">
      <text class="header-title min">团队介绍</text>
      <view class="introduce">
        {{ teamIntroduction }}
      </view>
    </view>
    <view class="box" style="margin: 30rpx 0">
      <text class="header-title min">{{ labelName }}文化</text>
      <view class="introduce">
        {{ enterpriseCulture }}
      </view>
    </view>
  </view>
</template>

<script setup>
import detailsTop from "./components/details-top.vue";
import VcCardBox from "./components/card.vue";
import {
  ref
} from "vue";
import tag from "./components/tag.vue";
import {
  getAppEnterpriseById,
  getCollectiveInfoById
} from "@/api/honour/index.js";
import {
  onLoad
} from "@dcloudio/uni-app";
import {
  onMounted
} from "vue";
import MyTab from "@/components/tabsCopy/index.vue";
import {getAppEnterpriseByIdApi} from "@/api/honour/enterprise-detail";
import {getUrlParamsInH5, getUrlParamsInWeixin} from "@/utils/utils";
import {getEnterpriseDetailApi} from "@/package_honour/pages/api/enterprise";

const businessScope = ref();
const mainBusiness = ref();

const labelName = ref("企业");
const listData = ref();
const teamIntroduction = ref("暂无")
const enterpriseCulture = ref('暂无')
const cardData = ref([
  {
    label: "法定代表人",
    value: "刘南余",
    type: "name",
    unit: "",
  },
  {
    label: "注册资本",
    value: "1138",
    type: "num",
  },
  {
    label: "成立日期",
    value: "2017.03.31",
    type: "data",
    unit: "",
  },
  {
    label: "企业规模",
    value: "中型",
    type: "name",
    unit: "",
  },
  {
    label: "行业类型",
    value: "软件开发",
    type: "name",
    unit: "",
  },
  {
    label: "所属区县",
    value: "72",
    type: "num",
  },
]);
const labelData = ref([
  "贵阳市市级C类人才",
  "贵阳市市级劳动模范",
  "中国青年科技进步奖获得者",
  "贵州省高层次人才引进计划",
  "贵州省大数据局特聘专家",
]);

const curEnterpriseId = ref('')
const curEnterpriseName = ref('')
const getEnterpriseDetail = async () => {
  const res = await getEnterpriseDetailApi(curEnterpriseId.value)
  const { code, data } = res
  if (code === 200) {
    let records = data;
    listData.value = {
      name: records.enterpriseName,
      state: records.registerStatus,
      label: records.enterpriseHonorInfoList ? records.enterpriseHonorInfoList.map((o) => {
        return o.enterpriseHonor
      }) : [],
      stage: records.scCode,
      phone: records.phone,
      address: records.address,
      id: records.registerNumber
    };
    teamIntroduction.value = records.teamIntroduction;
    mainBusiness.value = records.mainBusiness;
    cardData.value[0].value = records.legalRepresentative;
    cardData.value[1].value = records.capital;
    cardData.value[2].value = records.businessDate;
    cardData.value[3].value = records.enterpriseScale;
    cardData.value[4].value = records.industryBigType;
    cardData.value[5].value = records.counties;
    businessScope.value = records.businessScope;
    enterpriseCulture.value = records.enterpriseIntroductory;
    labelData.value = records.enterpriseHonorInfoList ? records.enterpriseHonorInfoList.map((
        o) => {
      return o.enterpriseHonor
    }) : []
  }
}
onLoad((option) => {
  uni.pageScrollTo({
    scrollTop: 0,
    duration: 0
  })
  uni.setNavigationBarTitle({
    title: `企业详情`,
  });
  /* #ifndef MP-WEIXIN */
  curEnterpriseId.value = getUrlParamsInH5()?.id
  curEnterpriseName.value = getUrlParamsInH5()?.enterpriseName
  /* #endif */

  /* #ifdef MP-WEIXIN */
  curEnterpriseId.value = getUrlParamsInWeixin()?.id
  curEnterpriseName.value = getUrlParamsInWeixin()?.enterpriseName
  /* #endif */

  getEnterpriseDetail()
  })
</script>

<style lang="less" scoped>
.honour-box {
  padding: 38rpx 34rpx 48rpx 34rpx;
  background-color: #fff;
  &-title {
    font-family: 'ali-p';
    font-weight: 500;
    color: #313233;
    font-size: 31rpx;
    letter-spacing: 1rpx;
  }
  :deep(.swiper-box) {
    margin-top: 40rpx;
    max-height: 200rpx;
    .uni-scroll-view-content {

    }
  }
}
.box {
  margin-top: 36rpx;

  .basic {
    font-family: "ali";
    font-weight: 400;
    font-size: @font-size-23;
    color: @color-black;
  }

  .introduce {
    font-family: "ali";
    font-weight: 400;
    font-size: @font-size-23;
    color: @color-label;
  }

  .elasticity-box {
    display: flex;
    flex-flow: row nowrap;
    margin-top: 15rpx;
    justify-content: flex-start;
    height: 60rpx;

    .btn {
      width: 120rpx;
      height: 52rpx;
      background: @bg-color;
      text-align: center;
      line-height: 52rpx;
      margin-right: 20rpx;
      padding: 0 20rpx;
      color: #5590f6;
    }
  }
}
</style>
